//
//  RecommendUserCell.m
//  Molian
//
//  Created by wansong on 3/31/15.
//  Copyright (c) 2015 xiaocan. All rights reserved.
//

#import "RecommendUserCell.h"

#import "MLUserDataViewController.h"

@implementation RecommendUserCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        //cell背景
        self.cellView = [[UIView alloc]initWithFrame:CGRectMake(10, 10, DeviceWidth-20, 500)];
        self.cellView.backgroundColor = [UIColor whiteColor];
        [self.contentView addSubview:self.cellView];
        
        CGFloat CellWidth = self.cellView.bounds.size.width;
  
        //推荐标题
        self.nicknameLabel = [[UILabel alloc]init];
        self.nicknameLabel.frame = CGRectMake(0, 5, CellWidth, 20);
        self.nicknameLabel.font = [UIFont fontWithName:FontName size:14];
        self.nicknameLabel.textColor = [UIColor blackColor];
        [self.cellView addSubview:self.nicknameLabel];
        
        // 恋人介绍
        self.introLabel = [[UILabel alloc]init];
        self.introLabel.frame = CGRectMake(0, 30, CellWidth, 100);
        self.introLabel.font = [UIFont fontWithName:FontName size:11];
        self.introLabel.textColor = [UIColor blackColor];
        // 多行
        self.introLabel.lineBreakMode = NSLineBreakByCharWrapping;
        self.introLabel.numberOfLines = 0;
        self.introLabel.textAlignment = NSTextAlignmentLeft;
        [self.cellView addSubview:self.introLabel];
        
        //喜欢按钮
        self.viewBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        self.viewBtn.frame = CGRectMake(0, 300, 100, 30);
        [self.viewBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [self.viewBtn setBackgroundColor:[UIColor paperColorRed400]];
        self.viewBtn.layer.masksToBounds = YES;
        [self.viewBtn.layer setCornerRadius:15];
        self.viewBtn.clipsToBounds = YES;
        [self.viewBtn setTitle:@"查看资料" forState:UIControlStateNormal];
        [self.viewBtn addTarget:self action:@selector(viewUserInfo) forControlEvents:UIControlEventTouchUpInside];
        [self.cellView addSubview:self.viewBtn];
        
    }
    
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

#pragma mark - User Interaction

// 查看用户资料
- (void)viewUserInfo {
    // 跳转到个人资料页
         MLUserDataViewController *userInfoVC = [[MLUserDataViewController alloc]init];
        userInfoVC.userData = self.user;
        //userInfoVC.likeUsers = self.likeUsers;
        userInfoVC.hidesBottomBarWhenPushed = YES;
        [self.parentViewController.navigationController pushViewController:userInfoVC animated:YES];
}

@end
